<!-- Copyright (C) Microsoft Corporation. All rights reserved. -->
<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="utf-8" />
	<title>GitHub Authentication - Sign In</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" type="text/css" media="screen" href="auth.css" />
</head>

<body>
	<a class="branding app-name" href="https://code.visualstudio.com/"></a>
	<div class="message-container">
		<div class="message">
			Sign-in successful! Returning to <span class="app-name"></span>...
			<br><br>
			If you're not redirected automatically, <a href="#" id="fallback-link" style="color: #85CEFF;">click here</a> or close this page.
		</div>
		<div class="error-message">
			An error occurred while signing in:
			<div class="error-text"></div>
		</div>
	</div>
	<script>
		const urlParams = new URLSearchParams(window.location.search);
		const error = urlParams.get('error');
		const redirectUri = urlParams.get('redirect_uri');

		if (error) {
			document.querySelector('.error-text')
				.textContent = error;
			document.querySelector('body')
				.classList.add('error');
		} else if (redirectUri) {
			// Set up the fallback link
			const fallbackLink = document.getElementById('fallback-link');
			if (fallbackLink) {
				fallbackLink.href = redirectUri;
			}

			// Redirect after a delay
			setTimeout(() => {
				window.location = urlParams.get('redirect_uri');
			}, 1000);
		}
	</script>
</body>

</html>
